import {timestampToTime} from '@/util/util.js';
import {MessageBox} from 'mint-ui';
export default {
  name:'tuiRentBill',
  data:() => ({
    tuiRent:'',
    detailList:[],
  }),
  mounted() {
    //do something after mounting vue instance
    let that = this;
    let exitId = that.$route.query.exitId;
    let retireParam = {
      exitId:exitId
    }
    network.get(configUrl.RETIRERENTINFO_URL,retireParam,function(res){
      console.log(res);
      let data = res.data;
      that.tuiRent = data;
      that.detailList = data.detailList;
    },function(err){
      console.log(err);
    });
  },
  methods:{
    // 查看电子合同
    toContact() {
      let that = this;
      let dataList = that.tuiRent;
      MessageBox.confirm('查看电子合同').then(action=>{
        window.location.href = dataList.electContract;  //电子合同地址
      }).catch(err=>{
        console.log(err);
      })
    },
  },
  computed: {
    exitTime:function () {
      let that = this;
      let exitTime = that.tuiRent.exitTime;
      return timestampToTime(exitTime);
    },
    rentTime:function () {
      let that = this;
      let rentBeginDate = that.tuiRent.rentBeginDate;
      let rentEndDate = that.tuiRent.rentEndDate;
      return timestampToTime(rentBeginDate)+'-'+timestampToTime(rentEndDate);
    }
  }
}
